const api = require('../../../utils/interface.js')
const math = require('../../../utils/math.js')
const tools = require('../../../utils/util.js')
Page({
  data: {
    details: {},
    cardName: ""
  },
  onLoad: function (options) {
    console.log(options)
    this.getConsumption(options.orderNumber)
    let cardName = wx.getStorageSync('userInfo').name
    this.setData({
      cardName: cardName
    })
  },
  // 获取消费订单明细
  getConsumption(orderNumber) {
    api.getOrder({ orderNumber }).then(res => {
      console.log(res.data.result)
      res.data.result.createTime_ = tools.formatTime(new Date(res.data.result.createTime))
      res.data.result.orderAmount_ = math.divide(res.data.result.orderAmount, 100)
      res.data.result.couponAmount_ = math.divide(res.data.result.couponAmount, 100)
      res.data.result.orderAmount_ = math.divide(res.data.result.orderAmount, 100)
      this.setData({
        details: res.data.result
      })
    })
  },

  onShow: function () {

  },
  // onUnload() {
  //   console.log('返回按钮')
  //   wx.switchTab({
  //     url: '/pages/index/index'
  //   })
  // }
  // onUnload() {
  //   console.log('返回按钮')
  //   wx.navigateBack({
  //     delta: 1
  //   })
  // }

})